{extend name="layout/main" /}

{block name="header"}

{/block}

{block name="content"}
<section class="panel">
    <header class="panel-heading">
        <h4>交易记录</h4>
    </header>
    <div class="panel-body" style="padding-bottom: 50px">
        <form class="form-horizontal" action="">
            <div class="form-group">
                <div class="col-xs-1 no-pd-r">
                    <select name="types" id="types" class="form-control">
                        <option value="0">状态类型</option>
                        <option {if $Request.get.types == '1'} selected {/if} value="1">等待付款</option>
                        <option {if $Request.get.types == '2'} selected {/if} value="2">等待收款</option>
                        <option {if $Request.get.types == '3'} selected {/if} value="3">交易完成</option>
                        <option {if $Request.get.types == '4'} selected {/if} value="4">交易失败</option>
                        <option {if $Request.get.types == '5'} selected {/if} value="5">取消交易</option>
                        <option {if $Request.get.types == '6'} selected {/if} value="6">申诉中</option>
                    </select>
                </div>
                <div class="col-xs-3 no-pd-l">
                    <input type="text" id="keyword" value="{$Request.get.keyword}" name="keyword" class="form-control" placeholder="请输入会员账号搜索">
                </div>
                <div class="col-xs-3 no-pd-l">
                    <input type="text" id="keyword1" value="{$Request.get.keyword1}" name="keyword1" class="form-control" placeholder="请输入卖出账号搜索">
                </div>
                <button type="submit" class="btn btn-color">搜索</button>
                <!--<a type="button" href="{:url('admin/Excelexport/walletLogList')}" class="btn btn-info">导出</a>-->
                <!--<button type="button" class="btn btn-success" id="export">导出</button>-->

            </div>
            <div class="form-group">
                <div class="col-xs-1 no-pd-r">
                    <select name="time_types" id="time_types" class="form-control">
                        <option value="0">时间类型</option>
                        <option {if $Request.get.time_types == 'create_time'} selected {/if} value="create_time">创建时间</option>
                        <option {if $Request.get.time_types == 'matching_time'} selected {/if} value="matching_time">匹配时间</option>
                        <option {if $Request.get.time_types == 'pay_time'} selected {/if} value="pay_time">付款时间</option>
                        <option {if $Request.get.time_types == 'end_time'} selected {/if} value="end_time">完成时间</option>
                        <option {if $Request.get.time_types == 'cancel_time'} selected {/if} value="cancel_time">取消时间</option>
                    </select>
                </div>
                <div class="col-xs-2 no-pd-2">
                    <input type="text" value="{$Request.get.startTime}" name="startTime" id="startTime" class="form-control" placeholder="请输入开始时间">
                </div>
                <div class="col-xs-2 no-pd-2">
                    <input type="text" value="{$Request.get.endTime}" name="endTime" id="endTime" class="form-control" placeholder="请输入结束时间">
                </div>
            </div>
        </form>
        <table class="table table-bordered table-striped no-margin">
            <thead>
            <tr>
                <th class="text-center">id</th>
                <th class="text-center">买入会员账号</th>
                <th class="text-center">买单类型</th>
                <th class="text-center">数量</th>
                <th class="text-center">价格</th>
                <th class="text-center">总价</th>
                <th class="text-center">卖出用户账号</th>
                <th class="text-center">状态</th>
                <th class="text-center">时间</th>
            </tr>
            </thead>
            <tbody>
            {if !empty($list)}
            {foreach $list as $entity}
            <tr>
                <form class="form-horizontal" method="post" onsubmit="return false" role="form">
                    <td class="text-center">{$entity->id}</td>
                    <td class="text-center">{if $entity->nick_name}账号:{$entity->nick_name}<br>手机号:{$entity->mobile}{else}尚未匹配{/if}</td>
                    <td class="text-center">{if $entity->trade_type == 1}<button class="btn btn-xs btn-info">求购</button>{elseif $entity->trade_type == 2}<button class="btn btn-xs btn-success">出售</button>{/if}</td>
                    <td class="text-center">{$entity->num} </td>
                    <td class="text-center">{$entity->price} </td>
                    <td class="text-center">{$entity->total} </td>
                    <td class="text-center">{if $entity->from_nick_name}账号:{$entity->from_nick_name}<br>手机号:{$entity->from_mobile}{else}尚未匹配{/if}</td>
                    <td class="text-center">
                        {if $entity->status == '1'}
                        <button class="btn btn-xs btn-default">等待付款</button>
                        <br>
                        <br>


                        {elseif $entity->status == '2'}
                        <button class="btn btn-xs btn-default">等待收款</button>
                        {elseif $entity->status == '3'}
                        <button class="btn btn-xs btn-default">交易完成</button>
                        {elseif $entity->status == '4'}
                        <button class="btn btn-xs btn-success">交易失败</button>
                        {elseif $entity->status == '5'}
                        <button class="btn btn-xs btn-danger">取消交易</button>
                        {elseif $entity->status == '6'}
                        <button class="btn btn-xs btn-danger">申述中</button>
                        {/if}
                    </td>
                    <td class="text-center">
                        创建: {$entity->create_time}<br/>
                        匹配: {$entity.create_time}<br/>
                        付款: {if $entity.pay_time}{:date('Y-m-d H:i:s',$entity.pay_time)}{else}尚未付款{/if}<br/>
                        完成: {if $entity.end_time}{:date('Y-m-d H:i:s',$entity.end_time)}{else}尚未完成{/if}
                    </td>
                </form>
            </tr>
            {/foreach}
            {else /}
            <tr class="text-center">
                <td colspan="7">暂无数据</td>
            </tr>
            {/if}
            </tbody>
        </table>
        <div class="page">
            {:htmlspecialchars_decode($list->render())}
        </div>
    </div>
</section>
{/block}


{block name="footer"}
<form action="{:url('admin/user/exportfzBncLog')}" id="exportForm">
    <input type="hidden" name="type" id="e_type">
    <input type="hidden" name="keyword" id="e_keyword">
</form>
<script src="__PUBLIC__/admin/js/laydate/laydate.js"></script>
<script>
    //导出会员信息
    $("#export").click(function(){
        var keyword = $("#keyword").val();
        var type = $("#type").val();
        $('#e_keyword').val(keyword);
        $('#e_type').val(type);
        $("#exportForm").submit();
    })
    function showContent(e){
        $.dialog({
            title: '手动匹配',
            content: $(e).attr('data-content')
        });
    }
    laydate.render({
        elem: '#startTime',
        type: 'datetime'
    });
    laydate.render({
        elem: '#endTime',
        type: 'datetime'
    });
</script>
{/block}